// 简单的语法检查脚本
const fs = require('fs');
const path = require('path');

function checkJSFiles(dir) {
  const files = fs.readdirSync(dir);
  
  files.forEach(file => {
    const filePath = path.join(dir, file);
    const stats = fs.statSync(filePath);
    
    if (stats.isDirectory()) {
      checkJSFiles(filePath);
    } else if (file.endsWith('.js')) {
      try {
        const content = fs.readFileSync(filePath, 'utf8');
        // 使用Function构造函数进行简单的语法检查
        new Function('"use strict"; ' + content);
        console.log(`✓ ${filePath} - 语法正确`);
      } catch (error) {
        console.error(`✗ ${filePath} - 语法错误:`, error.message);
      }
    }
  });
}

console.log('开始检查JavaScript文件语法...');
checkJSFiles('f:\\BajiWechat\\miniprogram');
console.log('检查完成！');